import java.util.HashSet;
import java.util.Set;

/**
 * @program: LeetCode
 * @description: LeetCode : 1207. 独一无二的出现次数
 * @author: WXY
 * @create: 2023-02-06 20:23
 * @Version 1.0
 **/
public class Num1207_uniqueOccurrences {
    public static boolean uniqueOccurrences(int[] arr) {
        int[] temp = new int[2010];
        for (int i = 0; i < arr.length; i++) {
            temp[arr[i] + 1000]++;
        }
        Set<Integer> set = new HashSet<>();
        for (int i = 0; i < temp.length; i++) {
            if (temp[i] == 0 ) {
                continue;
            }
            if (set.contains(temp[i])) {
                return false;
            }
            set.add(temp[i]);
        }
        return true;
    }

    public static void main(String[] args) {
        int[] arr = {1, 2, 2,  3, 3};
        boolean b = uniqueOccurrences(arr);
        System.out.println(b);
    }
}
